package com.xzh.controller;

import com.xzh.model.search.StudentSerach;
import com.xzh.service.StudentService;
import com.xzh.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/v1/student")
public class StudentController{
    private StudentService studentService;
    @Autowired
    public void setStudentService(StudentService studentService){
        this.studentService = studentService;
    }


    @GetMapping("/list")
    public ResponseEntity<JsonResult<?>> selectList(){
        List<StudentSerach> students = studentService.selectList();
        System.out.println( students.toString());
        return ResponseEntity.ok(JsonResult.success(students));
    }
}
